package com.mijie.indexall;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;

import org.apache.log4j.Logger;

import com.mijie.homi.search.util.god;
import com.mijie.query.fulltxtCtrlMultiThrd;

import m.secury.callbackItfs;


public class indexAllCls {

	/**
	 * @param args
	 */
	public static boolean isIng = false;
	public static int nowNum = 0;
	public static List li = new ArrayList();

	public static void main(String[] args) {

		indexAll(1,"nnn");
	}

	public	static Logger logger = Logger.getLogger("indexall_frmweb");
	public static void indexAll(final int lines,final String batchID) {
		if (!isIng) {			
			isIng = true;
			nowNum = 0;
			god.newThread(new Runnable() {

				@Override
				public void run() {
					fulltxtCtrlMultiThrd.callback = new callbackItfs() {

						@Override
						public Object callMethod(Object obj) {
							String s = (String) obj;
							logger.debug(obj);
							if (!s.trim().startsWith("insert into mood4fulllog")) {
								logger.info(obj);
								if (li.size() > 100)
									li = new ArrayList();
								else
									li.add(s);

							}
							return obj;
						}
					};
					fulltxtCtrlMultiThrd.main(new String[] {
							String.valueOf(lines), batchID });
					isIng = false;

				}
			}, "indexAll from web thrd");

		}

	}

}
